package com.nulldev.util.security.hashAPI.impls.bcrypt;

import com.nulldev.util.security.hashAPI.Hashable;

public class BCryptHash implements Hashable<byte[]> {

	@Override
	public byte[] hash(byte[] data) {
		return BCrypt.hashpw(new String(data), BCrypt.gensalt()).getBytes();
	}

	@Override
	public byte[] raw_hash(byte[] data) {
		return this.raw_hash(data);
	}

	@Override
	public String id() {
		return "native.bcrypt";
	}

	@Override
	public String[] hashes() {
		return new String[]
			{ "BCrypt", "bcrypt", "BCRYPT" };
	}

	@Override
	public Hashable<?> clone() {
		return this;
	}

}
